package com.yazi.mxz.person.controller.shop;

import javax.annotation.Resource;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.myframework.smhj.common.exception.MyException;
import com.myframework.smhj.jackson.result.StatusResult;
import com.yazi.mxz.common.service.OrderGoodsService;

@Controller("shop-orderGoodsController")
@RequestMapping("/shop/orderGoods")
public class OrderGoodsController extends BaseController {
	private static Logger log = LoggerFactory.getLogger(OrderGoodsController.class);
	
	@Resource
	OrderGoodsService orderGoodsService;
	
	
	@RequestMapping("/rectifyDo/json")
	@ResponseBody
	public StatusResult rectifyDoJson(long orderId, long orderGoodsId, float realCost) {
		debug(log, "修改订单商品费用");
		StatusResult jsonResult = new StatusResult();
		try {
			orderGoodsService.editCostByStore(getStore(true), orderId, orderGoodsId, realCost);
			jsonResult.setOk();
		} catch (MyException e) {
			jsonResult.setFailMessage(e.getMessage());
		} catch (Exception e) {
			error(log, e, "修改订单商品费用异常");
			jsonResult.setErrorMessage(e.getMessage());
		}
		return jsonResult;
	}
}
